

Texture2D shaderTexture;
SamplerState SampleType;


cbuffer LightBuffer
{
   float4 diffuseColor;
   float4 ambientColor;
   float3 lightDirection;
};


struct PixelInput
{
   float4 position : SV_POSITION;
   float2 tex : TEXCOORD0;
   float3 normal : NORMAL;
};



float4 PShader(PixelInput input) : SV_TARGET
{
   float4 textureColor;
   float  lightIntensity;
   float3 lightDir;
   float4 color = ambientColor; // start with the ambient color
   
   lightDir = -lightDirection;
   
   // Sample the texture at our position
   textureColor = shaderTexture.Sample(SampleType, input.tex);
   
   return textureColor;
   //return float4(input.normal.x, 0.0f, 0.0f, 1.0f);
   
   // Per pixel lighting
   lightIntensity = saturate(dot(input.normal, lightDir));
   
   if(lightIntensity > 0.0f)
   //{
      // Determine the final diffuse color based on the diffuse color and the amount of light intensity.
      color += (diffuseColor * lightIntensity);
   //}
   
   color = saturate(color);
   
   color = color * textureColor;

   return color;
}